﻿<cfsilent>
	
	<cfscript>
		
		jsonAdvice = getProperty("serviceFactory").getBean("jsonAdvice");

		response = structNew();
		structInsert(response, "success", false, true);

		taskId = event.getArg("TSK");
		taskType = event.getArg("TT");
		arrangeMode = event.getArg("MODE");
		
		transaction {
			
			/* 载入教学任务 */
			
			/* 修改教学班排课冲突检测模式 */
			switch(taskType){
					case 'C':
						sql = "	UPDATE
									t_common_task t
								SET
									t.task_mode = :ArrangeMode 
								WHERE
									t.tsk_id = :taskId ";
						break;
					case 'P':
						sql = "	UPDATE
									t_task t
								SET
									t.task_mode = :ArrangeMode 
								WHERE
									t.tsk_id = :taskId ";
						break;
					case 'R':
						sql = "	UPDATE
									t_reopen_task t
								SET
									t.task_mode = :ArrangeMode 
								WHERE
									t.tsk_id = :taskId ";
						break;
					case 'T':
						sql = "	UPDATE
									t_sport_task t
								SET
									t.task_mode = :ArrangeMode 
								WHERE
									t.tsk_id = :taskId ";
						break;
				}
				
				queryObj = new Query(datasource = application.dnsMaster);
				queryObj.addParam(name ="taskId", value=taskId, cfsqltype="cf_sql_varchar");
				queryObj.addParam(name ="ArrangeMode", value=arrangeMode, cfsqltype="cf_sql_char");
				queryObj.execute(sql = sql);
			
			structInsert(response, "success", true, true);
			
		}
		
		
	</cfscript>
	
</cfsilent><cfoutput>#jsonAdvice.encode(data:response, stringNumbers:true)#</cfoutput>